﻿//-----------------------------------------------------------------------
// <copyright file="ConsoleLogger.cs" company="OpenSource">
//     All code is Microsoft Public License (Ms-PL)
// </copyright>
// <history>
// 2013.02  Created         Chris Hand
// </history>
//-----------------------------------------------------------------------
namespace Sample
{
    using System;
    using OpenSource.TumblrAPI.Support;

    /// <summary>
    /// This should give you a rough idea how to create your own logger.  Or use this one ...
    /// </summary>
    public class ConsoleLogger : LoggerBase
    {
        /// <summary>
        /// Initializes a new instance of the ConsoleLogger class
        /// </summary>
        /// <param name="flags">Which messages should be shown</param>
        public ConsoleLogger(LogFlag flags)
            : base(flags)
        { 
        }

        /// <summary>
        /// Write the log entry
        /// </summary>
        /// <param name="flag">The flag value the entry is for</param>
        /// <param name="message">The message to show</param>
        protected override void WriteLog(LogFlag flag, string message)
        {
            Console.WriteLine("{0} [{1}] {2}", DateTime.Now.ToString("HH:mm:ss.fff"), flag, message);
        }
    }
}
